package pku;

import java.util.Collection;
import java.util.LinkedList;
import java.util.List;

/**
 * 消费者
 */

public class OldConsumer {
    private MessageReader messageReader = new MessageReader("./data");

    //将消费者订阅的topic进行绑定
    public void attachQueue(String queueName, Collection<String> t) throws Exception {
        messageReader.attachNames(queueName, t);
    }

    //每次消费读取一个message
    public ByteMessage poll() {
        if (messageReader.hasNext()) {
            return messageReader.next();
        } else {
            return null;
        }
    }
}
